package pres.lnk.learn.designpattern.j_decorator;

/**
 * <p>装饰器模式</p>
 * <pre>
 * 意图：动态给对象添加额外的职责，可以无限添加
 * 划分出具体的每一个职责，根据需求添加职责
 * </pre>
 * @Author lnk
 * @Date 2018/2/9
 */
public class Main {
    public static void main(String[] args) {
        //一个程序员
        DeveloperProgrammer dp = new DeveloperProgrammer();

        System.out.println("掌握JAVA开发的程序员");
        JavaSkill javaSkill = new JavaSkill(dp);
        javaSkill.masterSkill();
        System.out.println();

        System.out.println("掌握Mysql开发的程序员");
        MysqlSkill mysqlSkill = new MysqlSkill(dp);
        mysqlSkill.masterSkill();
        System.out.println();

        System.out.println("一个懂JAVA的mysql程序员");
        MysqlSkill mysqlAndJava = new MysqlSkill(javaSkill);
        mysqlAndJava.masterSkill();
        System.out.println();

        System.out.println("一个懂mysql的JAVA程序员");
        JavaSkill javaAndMysql = new JavaSkill(mysqlSkill);
        javaAndMysql.masterSkill();
        System.out.println();

    }
}
